/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.service.messaging;

import com.liferay.portal.kernel.messaging.BaseMessageListener;
import com.liferay.portal.kernel.messaging.Message;

import slcu.service.AlumnoLocalServiceUtil;
import slcu.service.CategoriaDisciplinaLocalServiceUtil;
import slcu.service.ClpSerializer;
import slcu.service.ConfiguracionLocalServiceUtil;
import slcu.service.CoordinadorLocalServiceUtil;
import slcu.service.DeportistaLocalServiceUtil;
import slcu.service.DirectorLocalServiceUtil;
import slcu.service.DisciplinaLocalServiceUtil;
import slcu.service.EquipoLocalServiceUtil;
import slcu.service.EscuelaLocalServiceUtil;
import slcu.service.InscripcionDisciplinaLocalServiceUtil;
import slcu.service.InscripcionLocalServiceUtil;
import slcu.service.InscripcionMensajeLocalServiceUtil;
import slcu.service.NotificacionRechazoLocalServiceUtil;
import slcu.service.PartidoLocalServiceUtil;
import slcu.service.PersonalDelMinisterioLocalServiceUtil;
import slcu.service.ProfesorLocalServiceUtil;
import slcu.service.PruebaDisciplinaLocalServiceUtil;
import slcu.service.PruebaInscripcionLocalServiceUtil;
import slcu.service.PuntajeLocalServiceUtil;
import slcu.service.SolicitudAltaAlumnoLocalServiceUtil;
import slcu.service.SolicitudAltaAlumnoMailDestinoLocalServiceUtil;

/**
 * @author Brian Wing Shun Chan
 */
public class ClpMessageListener extends BaseMessageListener {
	public static String getServletContextName() {
		return ClpSerializer.getServletContextName();
	}

	@Override
	protected void doReceive(Message message) throws Exception {
		String command = message.getString("command");
		String servletContextName = message.getString("servletContextName");

		if (command.equals("undeploy") &&
				servletContextName.equals(getServletContextName())) {
			AlumnoLocalServiceUtil.clearService();

			CategoriaDisciplinaLocalServiceUtil.clearService();

			ConfiguracionLocalServiceUtil.clearService();

			CoordinadorLocalServiceUtil.clearService();

			DeportistaLocalServiceUtil.clearService();

			DirectorLocalServiceUtil.clearService();

			DisciplinaLocalServiceUtil.clearService();

			EquipoLocalServiceUtil.clearService();

			EscuelaLocalServiceUtil.clearService();

			InscripcionLocalServiceUtil.clearService();

			InscripcionDisciplinaLocalServiceUtil.clearService();

			InscripcionMensajeLocalServiceUtil.clearService();

			NotificacionRechazoLocalServiceUtil.clearService();

			PartidoLocalServiceUtil.clearService();

			PersonalDelMinisterioLocalServiceUtil.clearService();

			ProfesorLocalServiceUtil.clearService();

			PruebaDisciplinaLocalServiceUtil.clearService();

			PruebaInscripcionLocalServiceUtil.clearService();

			PuntajeLocalServiceUtil.clearService();

			SolicitudAltaAlumnoLocalServiceUtil.clearService();

			SolicitudAltaAlumnoMailDestinoLocalServiceUtil.clearService();
		}
	}
}